package com.kcyu.sfhinvoice.config;

import cn.dev33.satoken.stp.StpInterface;
import com.kcyu.sfhinvoice.domain.User;
import org.springframework.stereotype.Component;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;

@Component
public class StpInterfaceImpl implements StpInterface {

    @Override
    public List<String> getPermissionList(Object loginId, String loginType) {
        User user = new User().selectById((Serializable) loginId);
        ArrayList<String> list = new ArrayList<>();
        list.add(user.getRole());
        return list;
    }

    @Override
    public List<String> getRoleList(Object loginId, String loginType) {
        User user = new User().selectById((Serializable) loginId);
        ArrayList<String> list = new ArrayList<>();
        list.add(user.getRole());
        return list;
    }
}
